<?php
/**
 * Created by IntelliJ IDEA.
 * User: Fernando
 * Date: 28/10/2014
 * Time: 20:04
 */

namespace Fiestissima\CRM\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class ClientesController extends Controller
{
    public function clientesParticularesAction()
    {
        $repo = $this->getDoctrine()->getRepository('FiestissimaCRM:ClientePersona', 'fiestissima');
        $query = $repo->createQueryBuilder('cp')
            ->orderBy('cp.cp_apellido', 'ASC')
            ->getQuery();

        $clientes = $query->getResult();

        return $this->render('FiestissimaCRM:Default:clientesparticulares.html.php', array('clientes' => $clientes));

    }

    public function clientesEmpresasAction()
    {
        $repo = $this->getDoctrine()->getRepository('FiestissimaCRM:ClienteEmpresa', 'fiestissima');
        $query = $repo->createQueryBuilder('ce')
            ->orderBy('ce.ce_razon_social', 'ASC')
            ->getQuery();

        $clientes = $query->getResult();

        return $this->render('FiestissimaCRM:Default:clientesempresas.html.php', array('clientes' => $clientes));
    }
}